<%--
*
* 描述：角色表SYSTEM_ROLE的list文件列表
* 
* @author fdf  
*
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.toncen.samepms.system.domain.Module"/>
<jsp:directive.page import="com.toncen.samepms.net.domain.Channel"/>
<jsp:directive.page import="com.toncen.samepms.system.domain.Role"/>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="g" uri="/fishergrid-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title><s:property value="operate"/>角色列表</title>
	<%@include file="/share/header.jsp"%>
	<s:head/>	
	<g:header theme="${sessionScope.skinCon.gridSkin}"/>	
  </head>
  <body>
	<script type="text/javascript">
		//新增
		function onDoAdd(name,g){
			var options={
				title:'【新增角色】',
				url:'<s:url action='new' namespace='/system/role'/>',
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1,
				multipleheight:0.5,
				tipstitle:'',
				tipscontent:''
			};
			top.MyWindow.open(options);
		}
		//修改		
		function onDoOperateRenderer(tdDiv,pid){
			var options={
				title:'【修改角色】',
				url:'<s:url action="edit" namespace='/system/role'/>?domain.id='+pid,
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1,
				multipleheight:0.4,
				tipstitle:'',
				tipscontent:''
			};
			var edithtml='<a href="javascript:void(0);" title="修改">修改</a>';
			
			var optionsOperationRight={
				title:'【角色模块操作权限设置】',
				url:'<s:url action="editPage" namespace='/system/roleblockright'/>?roleId='+pid,
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1.2,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};
			var editOperationRight='<a href="javascript:void(0);" title="设置操作权限">设置操作权限</a>';
			
			
			var permiturl="<%=path%>/system/functionpermission/grantResource.jsp?checkbox=true&threeState=true&level=1&resourceType=<%=Module.class.getName()%>&subjectType=<%=Role.class.getName()%>&subjectId="+pid;					
			var optionsPrivilege={
				title:'【授权模块】',
				url:permiturl,
				source : window,
				buttons:[top.MyWindow.ConfirmEmpower,top.MyWindow.Cancel],
				multiplewidth:0.4,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};
			var privilegehtml='<a href="javascript:void(0);" title="授权模块">授权模块</a>';
			
			
			
			var channelurl="<%=path%>/net/channel/grantChannel.jsp?checkbox=true&threeState=true&level=1&roleId="+pid;				
			var optionsChannel={
				title:'【授权栏目】',
				url:channelurl,
				source : window,
				buttons:[top.MyWindow.ConfirmEmpower,top.MyWindow.Cancel],
				multiplewidth:0.4,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};
			var channelhtml='<a href="javascript:void(0);" title="授权栏目">授权栏目</a>';
			
			
			
			$(tdDiv).html("");//去除原有的内容
			$(tdDiv).append($(edithtml).click(function(){//添加链接
											top.MyWindow.open(options);
										})
							);
							
			$(tdDiv).append(" / ");	
			$(tdDiv).append($(privilegehtml).click(function(){//添加链接
											top.MyWindow.open(optionsPrivilege);
										}));	
			
			$(tdDiv).append(" / ");	
			$(tdDiv).append($(channelhtml).click(function(){//添加链接
											top.MyWindow.open(optionsChannel);
										}));
			
			$(tdDiv).append(" / ");	
			$(tdDiv).append($(editOperationRight).click(function(){//添加链接
											top.MyWindow.open(optionsOperationRight);
										})
							);
		}	
		//查看		
		function onDoNameRenderer(tdDiv,pid){
			var options={
				title:'【查看角色】',
				url:'<s:url action="view" namespace='/system/role'/>?readonly=true&domain.id='+pid,
				source : window,
				buttons:[top.MyWindow.Close],
				multiplewidth:1,
				multipleheight:0.4,
				tipstitle:'',
				tipscontent:''
			};			
			var viewhtml='<a href="javascript:void(0);" title="查看【'+$(tdDiv).html()+'】详细信息">'+$(tdDiv).html()+'</a>';
			$(tdDiv).html("");//去除原有的内容
			$(tdDiv).append($(viewhtml).click(function(){//添加链接
											top.MyWindow.open(options);
										})
							);				
		}		
		//删除
		function onDoDelete(name,grid){
			onDoAjax({url:'<s:url action='deletes' namespace='/system/role'></s:url>'});
		}	
		//启用
		function onDoEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/system/role'></s:url>?domain.state=1',tip:'启用'});
		}
		//停用
		function onDoUnEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/system/role'></s:url>?domain.state=2',tip:'停用'});
		}
		//复制
		function onDoCopy(name,grid){
			onDoAjax({url:'<s:url action='copys' namespace='/system/role'></s:url>?copyName=name',tip:'复制'});
		}		
		//批量保存
		function onDoSaves(name,grid){
			fisherSaves({url:'<s:url action='saves' namespace='/system/role'></s:url>'});
		}											
	</script>  
  	<s:actionerror/>
  	<g:grid title="角色列表" name="/system/role/role.fisher.xml">
  		<g:select/>
  		<g:separator/>
  		<g:button name="新增" styleClass="fisherAdd" onclick="onDoAdd"/>
  		<g:button name="保存" styleClass="fisherSave" onclick="onDoSaves"/>   		
  		<g:separator/> 
  		<g:button name="启用" styleClass="fisherCheck" onclick="onDoEnable"/>
  		<g:button name="停用" styleClass="fisherUncheck" onclick="onDoUnEnable"/>
  		<g:separator/>  
  		<g:button name="复制" styleClass="fisherCopy" onclick="onDoCopy"/>
  		<g:separator/>   
	<s:if test="isSuperAdministrator()">  				  		 
  		<g:button name="删除" styleClass="fisherDelete" onclick="onDoDelete"/>
  		<g:separator/> 
  	</s:if>	  		  				
  		<g:query/>
  		<g:separator/>
  		<g:export/>  		
  	</g:grid>
  </body>
</html>
